#pragma once

// this buffer was made specifically for Sockets data management
#include "templatevector.h"

/**
 * a contiguous memory data structure for managing network input and output
 * based on a TemplateVector
 */
class ByteBuffer : public TemplateVector<unsigned char>
{
public:
	void reset();
	void clean();
	/** helper function for standard C-strings */
	void add(const char * const & data);
	void add(ByteBuffer * a_buffer);
	void addByte(const char & b);
	void addShort(const short & b);
	void addLong(const long & b);
	void addFloat(const float & b);
	void addBytes(const unsigned char * const & a_bytes, const int & a_numBytes);
	char getByte(const int & a_index);
	short getShort(const int & a_index);
	long getLong(const int & a_index);
	float getFloat(const int & a_index);
	void set(const char * data);
	void set(const int a_index, const unsigned char a_value);
	const int unusedSize();
	int socket_recv(void * a_socket);
	int socket_send(void * a_socket);
	~ByteBuffer();
};